﻿using System;
using System.ServiceModel;
using Ayatta.Contract.Component;
using Ayatta.Contract.Domain;
using System.Collections.Generic;

namespace Ayatta.Contract
{
    [ServiceContract(Namespace = ServiceContract.Namespace)]
    public interface IGameService : IService
    {
        [OperationContract]
        GameUser GetGameUser(int userId);

        [OperationContract]
        void UpdateGameUser(GameUser o);

        [OperationContract]
        PagedList<GameUser> GetPagedGameUsers(int index = 1, int size = 2, int userId = 0, string guid = null, int gameId = 0, int serverId = 0, int level = 0);

        [OperationContract]
        Game GetGame(int id);

        [OperationContract]
        IList<Game> GetGames(bool includeServers = false);

        [OperationContract]
        PagedList<Game> GetPagedGames(int index = 1, int size = 2, string name = null, GameType? type = null, GameCategory? category = null, bool? status = null, bool? isHot = false, bool? isRefined = false);

        [OperationContract]
        bool CreateGameServer(GameServer o);

        [OperationContract]
        bool UpdateGameServer(GameServer o);

        [OperationContract]
        GameServer GetGameServer(int id, bool inclGame = false);

        [OperationContract]
        IList<GameServer> GetGameServers(int gameId);

        [OperationContract]
        bool CreateGameArticle(GameArticle o);

        [OperationContract]
        bool UpdateGameArticle(GameArticle o);

        [OperationContract]
        GameArticle GetGameArticle(int id);

        [OperationContract]
        IList<GameArticle> GetGameArticles(int num = 10, int? gameId = null, int? flag = null);

        [OperationContract]
        IList<GameArticle> GetGameArticlesByParentId(int parentId);

        [OperationContract]
        PagedList<GameArticle> GetPagedGameArticle(int index = 1, int size = 50, int id = 0, int parentId = 0, string title = null, int? gameId = null, GameArticleCategory? category = null, GameArticleStatus? status = null, int? flag = null, DateTime? date = null);

        [OperationContract]
        GameTrial GetGameTrial(int id);

        [OperationContract]
        IList<GameTrial> GetGameTrials(int serverId);

        [OperationContract]
        bool CreateGameTrial(GameTrial o);

        [OperationContract]
        bool UpdateGameTrial(GameTrial o);

        [OperationContract]
        IList<int> GetGameTrialHistorys(int userId, int serverId);

        [OperationContract]
        int GetGameTrialIntegral(int userId, int trialId);

        [OperationContract]
        PagedList<GameTrialHistory> GetPagedGameTrialHistories(int index = 1, int size = 2, int? userId = null, int? serverId = null, int? level = null, DateTime? date = null);

        /// <summary>
        /// 领取新手卡
        /// </summary>
        /// <param name="gameId">游戏Id</param>
        /// <param name="serverId">游戏区服Id</param>
        /// <param name="userId">用户Id</param>
        /// <param name="username">用户名</param>
        /// <returns></returns>
        [OperationContract]
        string GetGameNoviceCardCode(int gameId, int serverId, int userId, string username);

        /// <summary>
        /// 批量上传新手卡
        /// </summary>
        /// <param name="gameId">游戏Id</param>
        /// <param name="codes">卡号</param>
        /// <returns></returns>
        [OperationContract]
        bool UploadGameNoviceCard(int gameId, string[] codes);

        /// <summary>
        /// 新手卡去重
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        int CheckGameNoviceCard(int gameId);

        [OperationContract]
        PagedList<GameNoviceCard> GetPagedGameNoviceCard(int index = 1, int size = 50, int gameId = 0, int serverId = 0,
                                                        int? userId = null, byte? status = null, DateTime? date = null);

    }
}